package wid;

import static org.junit.Assert.assertTrue;
import java.awt.Color;
import robocode.control.events.TurnEndedEvent;
import robocode.control.snapshot.IRobotSnapshot;
import robocode.control.testing.RobotTestBed;

/**
 * Ensures that the Robocode robot Pacifist is the correct colors.
 * 
 * @author David Wilkie
 */
public class TestPacifistColors extends RobotTestBed {

  /**
   * Specifies that Fire and Pacifist are to be matched up in this test case.
   * @return The comma-delimited list of robots in this match.
   */
  @Override
  public String getRobotNames() {
    return "sample.Fire,wid.Pacifist";
  }
  
  /**
   * This test runs for 10 rounds.
   * @return The number of rounds. 
   */
  @Override
  public int getNumRounds() {
    return 10;
  }
  
  /**
   * Called after each turn. 
   * Asserts that Botbotbot's colors are correct for the duration of the battle.
   * 
   * @param event The TurnEndedEvent.
   */
  @Override
  public void onTurnEnded(TurnEndedEvent event) {
    IRobotSnapshot pacifist = event.getTurnSnapshot().getRobots()[1];
    assertTrue("Check body color is green", pacifist.getBodyColor() == Color.GREEN.getRGB());
    assertTrue("Check gun color is white", pacifist.getGunColor() == Color.WHITE.getRGB());
    assertTrue("Check radar is yellow", pacifist.getRadarColor() == Color.YELLOW.getRGB()); 
  }
}
